package org.zhq.service;

import org.zhq.pojo.Users;
import org.zhq.pojo.bo.UserBO;
import org.zhq.pojo.vo.UsersVO;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public interface UsersService {
    /**
     * 判断用户名是否存在
     */
    boolean queryUsernameIsExist(String username);

    /**
     * 创建用户
     * @param userBO
     * @return
     */
    Users createUser(UserBO userBO);

    /**
     * 登录 检索用户名密码是否匹配
     *
     * @param username
     * @param password
     * @return
     */
    Users queryUserForLogin(String username, String password);

    /**
     * 存入redis cookie会话
     *
     * @param users
     * @param request
     * @param response
     */
    void storeUserForLogin(UsersVO users, HttpServletRequest request, HttpServletResponse response);

    /**
     * 移除redis cookie会话
     *
     * @param userId
     * @param request
     * @param response
     */
    void removeUserForLogin(String userId, HttpServletRequest request, HttpServletResponse response);
}
